#print("hello python!")

'''
import keyword
print(keyword.kwlist)
'''
from idlelib.debugger_r import dicttable
from json import JSONDecoder

from tenacity import retry

#单行注释

'''
多行注释
print("hello python!")
'''

"""
多行注释
print("hello python!")
"""

'''
x = "watermelon"
print(type(x))

x = 100
print(type(x))

x = (1,2,3,4)
print(type(x))

x = ('1','2','3')
print(type(x))

x = ['1','2','3']
print(type(x))
'''

'''
以下写法都可以正常变成字符串类型
'''

'''
word = '字符串'
sentence = "这是一个句子。"
paragraph = """这是一个段落，
可以由多行组成"""
'''

'''
print(word)
print(sentence)
print(paragraph)

#
str = "Watermelon"

#正常打印
print(str)
#输出第一个到倒数第二个的所有字符
print(str[0:-1])
#输出字符串第一个字符
print(str[0])
#输出从第三个开始到第五个的字符
print(str[2:5])
#输出从第三个开始后的所有字符
print(str[2:])
#输出从第二个开始到第五个且每隔两个的字符
print(str[1:5:2])
#输出字符串两次
print(str * 2)
#连接字符串
print(str + "你好")


#手动输入值
#input("这是一个简单的input信息")
#x = input("请输入信息：")
#print(x)
#print(type(x))
#转换为整形
#print(type(int(x)))

x = "a"
print( x, end=" " )
print("你好")
print()
'''

#from sys import argv, path  # 导入特定的成员

#print('================python from import===================================')
#print('path:', path)  # 因为已经导入path成员，所以此处引用时不需要加sys.path

"""
class Person():
    #person类
    name = '小明'
    url = 'www.baidu.com'

    def __init__(self):
        self.name = 'linux'
        self.url = 'hello,linux'

    def say(self):
        self.age = 13

    def __repr__(self):
        return f"Person[name={self.name},uil={self.url}]"
# 实例对象1
p01 = Person()
p01.name = 'java'
p01.url = 'java is very good.'
print(p01.name , p01.url)
# 实例对象2
p02 = Person()
print(p02.name, p02.url)
# 类变量
print(Person.name)
print(Person.url)

print(p01.__repr__())
"""

"""
str = "hello World"
print(str.capitalize())
print(str.count("l"))
print(str.endswith("o"))

str1 = "12,32,43,54,6,76,786,1"

print(str1.replace(",",""))
"""

"""
arr = [8989,777709,31,44,88,107,456464,84121,85203,64,10.5,656,89112,177,355,211,12.5,631]
a = [i * 3 for i in arr]
print(list(a))

b = lambda x:(i * 3 for i in x)
print(list(b(arr)))

c = map(lambda x:x * 3 ,arr)
print(list(c))
"""

import pandas as pds
import os
import json
from com.watermelon.rpa.receipt_obj.ReceiptConvertObj import *

filePathName = r"D:\Dot\RPA\FourteenDay\receipt.xlsx"
filePath = r"D:\sutdy-Rpa-file\13课"

"""
查看文件是否存在
if os.path.exists(filePathName):
    print(f'文件{filePathName}存在')
else:
    open(filePathName, "w").close()
    print(f'文件{filePathName}不存在')

writeData = {"序列":[1,2,3,4,5],"人员":['帅哥1','帅哥2','帅哥3','帅哥4','帅哥5'],"地址":['北京','深圳','上海','南京','成都'],"年龄":[21,22,23,24,25],"月薪":[12000,13000,14000,15000,16000]}

fwrite = pds.DataFrame(writeData)
fwrite.to_excel(filePathName,index=False)
"""
"""
读取excel文件内容
excelFileData = pds.read_excel(filePathName)
print(excelFileData.to_dict("list"))
"""

"""
dicts = {'PurchaserAddress': '', 'PurchaserBank': '', 'Password': '0-57*+2/6<08-3534>9-9695>1-595++518-68+-97<19>67*19<*/01907>5<>>-88105-3166<839095<973-7-<94++74<+06*15-4<45', 'CommodityVehicleType': [], 'SellerRegisterNum': '91330100552660066F', 'SellerBank': '上海浦东发展银行杭州高新支行95130154800003964', 'CommodityNum': [{'row': '1', 'word': '1'}], 'CommodityAmount': [{'row': '1', 'word': '185.93'}], 'InvoiceType': '电子普通发票', 'AmountInWords': '壹佰捌拾陆圆整', 'TotalTax': '0.07', 'MachineCode': '661620034630', 'City': '', 'InvoiceNumDigit': '', 'Checker': '陈焕生', 'InvoiceCode': '033002000111', 'SellerAddress': '杭州市江干区钱潮路369号智谷人才广场8楼0571-87233885', 'CommodityPrice': [{'row': '1', 'word': '185.93'}], 'NoteDrawer': '刘荣佑', 'Province': '浙江省', 'InvoiceNum': '74172194', 'CommodityTaxRate': [{'row': '1', 'word': '***'}], 'ServiceType': '服务', 'InvoiceDate': '2020年06月12日', 'CommodityEndDate': [], 'PurchaserRegisterNum': '91310105572715984J', 'CommodityStartDate': [], 'TotalAmount': '186.00', 'SheetNum': '', 'CommodityPlateNum': [], 'PurchaserName': '上海艺赛旗软件股份有限公司', 'SellerName': '浙江外企德科人力资源服务有限公司', 'InvoiceNumConfirm': '74172194', 'Agent': '否', 'InvoiceTag': '其他', 'CommodityUnit': [], 'CheckCode': '79585562461837809249', 'InvoiceTypeOrg': '浙江增值税电子普通发票', 'InvoiceCodeConfirm': '033002000111', 'Remarks': '差额征税:184.51。', 'Payee': '俞兰', 'CommodityTax': [{'row': '1', 'word': '0.07'}], 'AmountInFiguers': '186.00', 'CommodityName': [{'row': '1', 'word': '*人力资源服务*劳务费-代驾'}], 'CommodityType': [], 'OnlinePay': ''}


pdf_files = [file for file in os.listdir(filePath)
             if os.path.isfile(os.path.join(filePath, file))
             and os.path.splitext(file)[1].lower() == '.pdf']

# 输出PDF文件的个数
print(f'文件夹{filePath}下有{len(pdf_files)}个PDF文件')

for file in pdf_files:
    print(filePath + "\\" + file)


#for file in os.listdir(filePath):
#    os.path.isfile(os.path.join(filePath, file))   #先拼接路径 在 判断是否为文件
#print(os.path.splitext("RPA面试准备模板.xlsx")[1] == ".pdf")

#def to_dict_obj(dict_data):
items = ['apple', 'banana', 'cherry']
print(list(enumerate(items)))
"""

import requests
import re

cookies = {
    'BIDUPSID': '6656A662B09C1F74F6A2DB40696A05F9',
    'PSTM': '1717491685',
    'MCITY': '-75%3A',
    'BAIDUID': '6656A662B09C1F74F6A2DB40696A05F9:SL=0:NR=10:FG=1',
    'MAWEBCUID': 'web_GEDxyhveaLzIDAaWUxmFljeBtdRsmavFARejRCzvGNRLIqMlRz',
    'BDUSS': 'Rwcm52NkJTTXQ3eWpZQmxSQ0JTYkRSSGVHem9vMmYxVEpObWpuN1FnOFNlS2RuSVFBQUFBJCQAAAAAAAAAAAEAAACXjFuBMTIzNGhhdGFjAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABLrf2cS639nMW',
    'BDUSS_BFESS': 'Rwcm52NkJTTXQ3eWpZQmxSQ0JTYkRSSGVHem9vMmYxVEpObWpuN1FnOFNlS2RuSVFBQUFBJCQAAAAAAAAAAAEAAACXjFuBMTIzNGhhdGFjAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABLrf2cS639nMW',
    'bce-sessionid': '0012c9d6abaeddd460499bc688c7cfa6227',
    'H_WISE_SIDS': '60277_61027_60853_61361_61502_61528_61575_61696_61780_61788',
    'H_WISE_SIDS_BFESS': '60277_61027_60853_61361_61502_61528_61575_61696_61780_61788',
    'BAIDUID_BFESS': '6656A662B09C1F74F6A2DB40696A05F9:SL=0:NR=10:FG=1',
    'delPer': '0',
    'PSINO': '6',
    'BDRCVFR[feWj1Vr5u3D]': 'I67x6TjHwwYf0',
    'BCLID': '17797987596406442835',
    'BCLID_BFESS': '17797987596406442835',
    'BDSFRCVID': 'JlFOJexroGWp8unJuhzCEHtYogKK0gOTDYLEUamaI2AU2V4VY-HoEG0Pt_U-mEt-J8jwogKKXgOTHwW6_gt2QeWIOIinY2PvD4Oatf8g0M5',
    'BDSFRCVID_BFESS': 'JlFOJexroGWp8unJuhzCEHtYogKK0gOTDYLEUamaI2AU2V4VY-HoEG0Pt_U-mEt-J8jwogKKXgOTHwW6_gt2QeWIOIinY2PvD4Oatf8g0M5',
    'H_BDCLCKID_SF': 'tbkD_C-MfIvDqTrP-trf5DCShUFsXU5RB2Q-XPoO3M3lHnQ4yxQ1jT-kyhOk2-biWbRM2MbgylRp8P3y0bb2DUA1y4vpXCr7a2TxoUJ2XMKVDq5mqfCWMR-ebPRiXPb9Qgbf-KQ75--KVqPlyfnZX6kYQt6L54rLBTnhVn0MBCK0hI0ljj82e5PVKgTa54cbb4o2WbCQWfTN8pcN2b5oQp-A-UjHBfo7J5R4aPbwab3vOIJTXpOUWfAkXpJvQnJjt2Jxaq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yxv4WDunhPoxJpOJXaILWl52HlFWj43vbURvW--g3-7fL55d55PHblPhWl7Z8CntQf6V-tuDXhOhqP-jBRIEoK0hJC-2bKvPKITD-tFO5eT22-usKKrJ2hcHMPoosU3a-PjKyx_njNQ4Bn3kaKviaKJjBMbUoqRHXnJi0btQDPvxBf7py4j7Wh5TtUJM_UKzhfoMqfTbMlJyKMniyIv9-pn5QKQreP-40fAayf44XG7G0xTLKCjL2PbDfn028DKuDTtajj3QeaRt2tcyatj2WnTJ25r8e5rnhPF3y4AzXP6-hnjy3avjVP58Wt5sJlOHybOZhP-UyN3MWh3RymJ4-RjEKlIKEfK436O4WDunhPoxJpOJXaILWl52HlFWj43vbURvW--g3-7fL55d55PHbR56Wl7zjJrXDl3-Q50g-qOhqP-jBRIE3-oJqC_MhIPR3f',
    'BA_HECTOR': '8h2kah2h218l2k0ka10g8k2g85qvr31jp3bqk1u',
    'ZFY': 'CYpvSw6d1nBMNZFjXSdGH2x8h8QhoSt6FFAF5Yuwcbc:C',
    'H_PS_PSSID': '60277_61027_60853_61361_61747_61745_61743_61780_61788_61843_61804_61859_61985',
    'BDORZ': 'B490B5EBF6F3CD402E515D22BCDA1598',
    'RT': '"z=1&dm=baidu.com&si=921b1846-c78b-49cc-b79e-e8a9eccfc4e6&ss=m68qouoe&sl=1&tt=3zd&bcn=https%3A%2F%2Ffclog.baidu.com%2Flog%2Fweirwood%3Ftype%3Dperf"',
    'ab_sr': '1.0.1_OWZhNGFiMDA4MzA1NzY5OThmN2VlYmRlOTM5NzZiM2EwYjVhNzc5N2FjMWU3Nzg4NDQzY2RjMWY5YTZkNDRhMzVmMDc2OWFkZTE1OGI1YTVhY2M2YTFjOWM2NTdlOTU5NGQ4M2UwZjQ0YWQ5YjIwNTA1NTFjMTkwZDhjMTM0OTYxMmVkYjRhZWFlNmFlMzhjZjkzYzhhNWI5YTMzYzVmZDA2YTYwYzQ1YjFkMmRkMTlmMjRjYjRiODc3ZTBiZjJkNDIyMDkzZWMwZTBjNDZjODE3MWQ4Y2ZhZWRkY2RkMjU=',
}

headers = {
    'Accept-Language': 'zh-CN,zh;q=0.9',
    # 'Acs-Token': '1737540226271_1737600881826_KbscfrgJMquwnZdUfM2ODolKlycbBQcYJtP7ibDUJwjrLq731nDSt7mbrCP/jhZgMFr3TQf+46l4dLDMybsVcJg0icED5EtY9pIoF78ONJO6vbAY6VHRJfWQbxZasesr+0Ph3JHAL9V5RI7ET2Zyrli1Nz0XAOxXDlSJCQ0j2wAUW6LBD91OAJ02G+iDJ9E0gyzTmnqXOlqW/pjR6Cej1OgqZv9Ia4/OgaOXMuK7otbGfQXps4CggtPpF/AiYK8PsC3A8Ud2vayhxN6vOA8fqZsb+VNpfU3aOVMCqYPRK1ZzZBBY7wvoYAewaZqhoxF15GSTPrhCmyoAAFKt5mizm2k43hQ1MX/VB1eDcinJLjy/5op3SyVAxLFxM0eHSTKO5IVvC0+eHZg3hkH2t28EsWi0Spfz1Jo6lEg9rwTnCFW6l6cauTpi45UA17s9AdKQWdpCZoZHKxeQhbilBPz69OE/ZMq3Sj0FeeML9khOQ0Re0TRVSgXQaeJ8wLCACdCN',
    'Connection': 'keep-alive',
    'Content-Type': 'application/json',
    # 'Cookie': 'BIDUPSID=6656A662B09C1F74F6A2DB40696A05F9; PSTM=1717491685; MCITY=-75%3A; BAIDUID=6656A662B09C1F74F6A2DB40696A05F9:SL=0:NR=10:FG=1; MAWEBCUID=web_GEDxyhveaLzIDAaWUxmFljeBtdRsmavFARejRCzvGNRLIqMlRz; BDUSS=Rwcm52NkJTTXQ3eWpZQmxSQ0JTYkRSSGVHem9vMmYxVEpObWpuN1FnOFNlS2RuSVFBQUFBJCQAAAAAAAAAAAEAAACXjFuBMTIzNGhhdGFjAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABLrf2cS639nMW; BDUSS_BFESS=Rwcm52NkJTTXQ3eWpZQmxSQ0JTYkRSSGVHem9vMmYxVEpObWpuN1FnOFNlS2RuSVFBQUFBJCQAAAAAAAAAAAEAAACXjFuBMTIzNGhhdGFjAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABLrf2cS639nMW; bce-sessionid=0012c9d6abaeddd460499bc688c7cfa6227; H_WISE_SIDS=60277_61027_60853_61361_61502_61528_61575_61696_61780_61788; H_WISE_SIDS_BFESS=60277_61027_60853_61361_61502_61528_61575_61696_61780_61788; BAIDUID_BFESS=6656A662B09C1F74F6A2DB40696A05F9:SL=0:NR=10:FG=1; delPer=0; PSINO=6; BDRCVFR[feWj1Vr5u3D]=I67x6TjHwwYf0; BCLID=17797987596406442835; BCLID_BFESS=17797987596406442835; BDSFRCVID=JlFOJexroGWp8unJuhzCEHtYogKK0gOTDYLEUamaI2AU2V4VY-HoEG0Pt_U-mEt-J8jwogKKXgOTHwW6_gt2QeWIOIinY2PvD4Oatf8g0M5; BDSFRCVID_BFESS=JlFOJexroGWp8unJuhzCEHtYogKK0gOTDYLEUamaI2AU2V4VY-HoEG0Pt_U-mEt-J8jwogKKXgOTHwW6_gt2QeWIOIinY2PvD4Oatf8g0M5; H_BDCLCKID_SF=tbkD_C-MfIvDqTrP-trf5DCShUFsXU5RB2Q-XPoO3M3lHnQ4yxQ1jT-kyhOk2-biWbRM2MbgylRp8P3y0bb2DUA1y4vpXCr7a2TxoUJ2XMKVDq5mqfCWMR-ebPRiXPb9Qgbf-KQ75--KVqPlyfnZX6kYQt6L54rLBTnhVn0MBCK0hI0ljj82e5PVKgTa54cbb4o2WbCQWfTN8pcN2b5oQp-A-UjHBfo7J5R4aPbwab3vOIJTXpOUWfAkXpJvQnJjt2JxaqRCy661Dp5jDh3MBpQDhtoJexIO2jvy0hvcyn3cShn63Tjrbn3X0tADBxRkBJbGKlcEKR6V8-bIe-t2XjQhDNtDt60jfn3aQ5rtKRTffjrnhPF3BTLUXP6-hnjy3avP3bQ-W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kaKviaKJjBMbUoqRHXnJi0btQDPvxBf7py4j7Wh5TtUJM_UKzhfoMqfTbMlJyKMniyIv9-pn5QKQreP-40fAayf44XG7G0xTLKCjL2PbDfn028DKuDTtajj3QeaRt2tcyatj2WnTJ25r8e5rnhPF3y4AzXP6-hnjy3avjVP58Wt5sJlOHybOZhP-UyN3MWh3RymJ4-RjEKlIKEfK436O4WDunhPoxJpOJXaILWl52HlFWj43vbURvW--g3-7fL55d55PHbR56Wl7zjJrXDl3-Q50g-qOhqP-jBRIE3-oJqC_MhIPR3f; BA_HECTOR=8h2kah2h218l2k0ka10g8k2g85qvr31jp3bqk1u; ZFY=CYpvSw6d1nBMNZFjXSdGH2x8h8QhoSt6FFAF5Yuwcbc:C; H_PS_PSSID=60277_61027_60853_61361_61747_61745_61743_61780_61788_61843_61804_61859_61985; BDORZ=B490B5EBF6F3CD402E515D22BCDA1598; RT="z=1&dm=baidu.com&si=921b1846-c78b-49cc-b79e-e8a9eccfc4e6&ss=m68qouoe&sl=1&tt=3zd&bcn=https%3A%2F%2Ffclog.baidu.com%2Flog%2Fweirwood%3Ftype%3Dperf"; ab_sr=1.0.1_OWZhNGFiMDA4MzA1NzY5OThmN2VlYmRlOTM5NzZiM2EwYjVhNzc5N2FjMWU3Nzg4NDQzY2RjMWY5YTZkNDRhMzVmMDc2OWFkZTE1OGI1YTVhY2M2YTFjOWM2NTdlOTU5NGQ4M2UwZjQ0YWQ5YjIwNTA1NTFjMTkwZDhjMTM0OTYxMmVkYjRhZWFlNmFlMzhjZjkzYzhhNWI5YTMzYzVmZDA2YTYwYzQ1YjFkMmRkMTlmMjRjYjRiODc3ZTBiZjJkNDIyMDkzZWMwZTBjNDZjODE3MWQ4Y2ZhZWRkY2RkMjU=',
    # 'Origin': 'https://fanyi.baidu.com',
    # 'Referer': 'https://fanyi.baidu.com/mtpe-individual/multimodal?aldtype=16047&query=+drain&keyfrom=baidu&smartresult=dict&lang=auto2zh&ext_channel=Aldtype',
    # 'Sec-Fetch-Dest': 'empty',
    # 'Sec-Fetch-Mode': 'cors',
    # 'Sec-Fetch-Site': 'same-origin',
    'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/132.0.0.0 Safari/537.36',
    # 'accept': 'text/event-stream',
    # 'sec-ch-ua': '"Not A(Brand";v="8", "Chromium";v="132", "Google Chrome";v="132"',
    # 'sec-ch-ua-mobile': '?0',
    # 'sec-ch-ua-platform': '"Windows"',
}

json_data = {
    'query': '苹果',
    'from': 'zh',
    'to': 'en',
    'reference': '',
    'corpusIds': [],
    'needPhonetic': False,
    'domain': 'common',
    'milliTimestamp': 1737600881992,
}
#
# url = 'https://fanyi.baidu.com/ait/text/translate'
#
# response = requests.post(url, headers=headers, json=json_data)
#
# regularStr = '"dst":"(.*?)"'
#
# result = re.findall(regularStr,response.text)
#
#
# print("".join(result))
#
# text = "Hello, this is a Test. Another TEST and some more words."
# text1 = "匹配搭配的is"
#
# # 正则表达式：匹配英文单词，不区分大小写
# pattern = r'\b[a-zA-Z]+\b'
#
# # 使用 re.findall 查找所有匹配的单词
# matches = re.findall(pattern, text1, re.IGNORECASE)
#
# for i in matches:
#     print("匹配到的单词:", i)
#
# # print("匹配到的单词:", matches)


# shop1 = {"地区":"杭州","面积":300,"评分":5}
# shop2 = {"地区":"苏州","面积":"180","评分":"2"}
# shop3 = {"地区":"吐鲁番","面积":"30","评分":"1"}
#
# shopList = [shop1,shop2,shop3]
#
# show  = input("请输入地区:")
#
# print(str(shopList))
# if show in str(shopList):
#     print("有门店")
#     for shop in shopList:
#         if shop["地区"] == show:
#             print(f"地区{shop["地区"]}，面积{shop["面积"]}，评分{shop["评分"]}")
# else:
#     print("无门店")


# def a(b):
#     print(b)
#
# d = input("A:少，B:中，C:多")
# a({"A":"少","B":"中","C":"多"}[d])

'''
try:
    a = input("请输入一个数字：")
    if not a.isdigit():
        raise ValueError("输入的不是数字")
    b = int(a)
    result = 100 / b
    print(result)
except ValueError as v:
    print(f"错误为:{v}")
except ZeroDivisionError as z:
    print(f"错误为:{z}")
except:
    print("未知错误")
finally:
    print("释放")
'''

# datatable = [
#     ["序列", "票房（万元）", "其他列"],
#     [1, "123.45", "其他数据"],
#     [2, "456.78", "其他数据"],
#     [3, "非数字", "其他数据"],
#     [4, "789.01", "其他数据"]
# ]
#
# df = pds.DataFrame(datatable,columns=datatable.pop(0))
# df["票房"] = df["票房（万元）"].str.extract(r'^(\d+(\.\d+)?)')[0]
# df = df[df["票房"].notna()]
# df = df.drop(columns=["序列","票房（万元）"])   #这里的序列和datatable中的序列要一致
# datatable = df.values.tolist()
#
# print(datatable)


import json

data = '''
{
    "城市":"杭州",
    "温度":28.5,
    "天气":"晴朗",
    "预报":[
        "多云","暴雨","雷阵雨"
    ],
    "风":{
        "方向":"东南",
        "速度":10.2
    },
    "空气质量":null,
    "是否节假日":false
}
'''
data_python = ""
with open("test.json","r",encoding="utf-8") as f:
    data_python = f.read()
    print(json.loads(data_python))

data_json = json.dumps(data_python,ensure_ascii=False)
print(data_json,type(data_json),sep="\n")

print("===="*50)

for i in range(1,6):
    if i != 2 and i < 4:
        continue
    for j in range(6,11,2):
        print(j-i,end=",")

print("==="*100)

print(os.path.join(os.environ['USERPROFILE'], 'Desktop'))

print("==="*100)
dict1 = {'A':3,'B':4}
dict2 = dict1
dict1['A'] = 9
result = dict1['A'] + dict2['A']
print(result)

print("==="*100)

y = [15,
     [2.718,25,
      [35,'bar',3.142]
      ]
    ,'bar']
print(y[1][2][0])

print("==="*100)
test = 'I enjov coding with python and java'
print(test.replace('I','We'))
print(test.replace('o','#',2))

print("==="*100)

a=a=[('f',1),('g',2),('e',3),('h',5)]
b = a.sort()
print(a,b)

print("==="*100)
print(len('abcd') == 4)
print('x' in 'abc')
print(5 in [1,2,3,4,5])
print(4 >= 3)

print("==="*100)
dict1 = {'A':3,'B':4,'C':5}
print(list(dict1))

print("==="*100)

#text = "哪吒之魔童闹海（8.5）"
#text = "220739 &"

text = "%%陈凯歌 你好*&&"

# 使用正则表达式匹配数字
#match = re.search(r'(\d+\.\d+)', text)
#result = re.sub(r'\D', '', text)  # \D 匹配任何非数字字符
result = re.sub(r'[^\w\u4e00-\u9fa5]', '', text)
print(result)
# 使用正则表达式匹配括号之前的内容
#match = re.match(r'^(.*?)\（', text)

# if match:
#     rating = match.group(1)  # 获取匹配的数字部分
#     print(rating)  # 输出: 8.5
# else:
#     print("未找到匹配的数字")

print("==="*100)
test = 'efgh34ijk'
print(test.upper().title())

testData = '''

科大讯飞股份有限公司（iFLYTEK CO.LTD.）成立于 1999 年，是亚太地区知名的智能语音和人工智能上市企业，公司总部在合肥。自成立以来，一直从事智能语音、自然语言理解、计算机视觉等核心技术研究并保持了国际前沿技术水平；积极推动人工智能产品和行业应用落地，致力让机器「能听会说，能理解会思考」，用人工智能建设美好世界。

近日，科大讯飞股份有限公司（以下简称「科大讯飞」）与深圳市奥思网络科技有限公司（开源中国）达成战略合作，选择 Gitee 旗舰版 作为其研发协作平台的国产化替代方案。
在 Gitee 旗舰版团队的努力下，已经完成了科大讯飞团队超过 36000 个仓库，总大小超过 6TB 研发数据的迁移，并实现了该过程的 0 错误、0 回滚、0 影响。
为智慧技术插上「红色」翅膀
信创产业即信息技术应用创新产业，是我国数字化转型的重要组成部分，也是关键基础设施的重要支撑。在政策驱动下，信创产业链趋于完善，场景从党政市场向重点行业深化。
科大讯飞拥有全球领先的人工智能核心技术，这些核心技术全部来自于科大讯飞的自主研发，拥有自主知识产权。同时，科大讯飞也积极响应国家号召，积极地对其技术研发平台进行国产化替代，这也成为了科大讯飞与开源中国强强联合的契机。

作为国家开源代码托管平台的牵头单位，开源中国为国家建设自主研发、国内部署、国际领先、并服务全球的开源代码托管平台的目标奋力前行。
科大讯飞团队将原有的研发协作平台 GitLab 替换为安全、自主、可控，有完整的独立知识产权的 Gitee 旗舰版，并将全部研发数据迁移至 Gitee 旗舰版运行使用，确保国有数据安全，完成了基础研发软件层面的国产化替代，实现自主可控，为科大讯飞的智慧技术插上“红色” 翅膀。
打造异地容灾体系，确保数字资产安全
科大讯飞团队在合肥、武汉两地均有研发中心，如何构建异地安全和灾备体系，高效保障研发体系数据安全与业务连续，满足科大讯飞对研发平台高可靠性的要求，成为了 Gitee 旗舰版团队面临的巨大挑战。
经过 Gitee 旗舰版团队内部研究并多次与科大讯飞团队的沟通后，最终决定采用以下方案确保核心数据的安全：


使用业界领先的多分片多副本架构，避免了仓库单点存储，让科大讯飞团队的代码托管均匀、稳定、快速；
采用异地灾备技术，提高了异地访问速率，让开发人员可以全身心投入高端科技技术研发
'''

# print(testData.strip())
print("==="*100)

item = {"name": "武器升级", "category": "休闲类", "date": "2024-01-06"}
result = json.loads(json.dumps(item))
#print(type(item))
#result = json.dumps(item)

print(type(result),result)

print("==="*100)
json_data = { 'account': 'demo', 'pwd': 'crmeb.com', 'captchaType': '', 'captchaVerification': '', }
url = "https://pro.crmeb.net/adminapi/login"

result = requests.request(url=url,data=json_data,method="POST")
print(result.text)

print("==="*100)

def func(**values):
    print(values)
    print(type(values))


func(a=10, b=20, c=30, d=40, e=50, f=60, g=70)


print("==="*100)
for i in range(1,10):
    for j in range(1,i+1):
        print(f"{j}*{i}={j*i}", end="\t")
    print()

print("==="*100)

# num = int(input("num="))
# # reversed_num = 0
# # while num > 0:
# #     reversed_num = reversed_num * 10 + num % 10
# #     num //= 10
# #
# # print(reversed_num)
# num = str(num)
# print(num[::-1])
# print("==="*100)


#斐波那契额数列
fibonacci = [0,1]
while len(fibonacci) < 20:
    fibonacci.append(fibonacci[-1] + fibonacci[-2])
print(fibonacci)
